<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>forms 集合</title>
</head>
<body>
<form action="" name="form1">
    <p>This is inside form1.</p>
</form>
<form action="" name="form2">
    <p>This is inside form2.</p>
</form>
<form action="" name="form3">
    <p>This is inside form3.</p>
</form>
<script>
    var numberForms = document.forms.length;
    for (var i = 0; i < numberForms; i++) {
        alert(document.forms[i].name);
    }
</script>
</body>
</html>